
package com.lry.protocol;

import java.io.Serializable;


public class HeartbeatInvocation implements Serializable,Invocation {
    private static final long serialVersionUID = -985316399527884899L;
    private boolean ping = true;
    /**
     * The constant PING.
     */
    public static final HeartbeatInvocation PING = new HeartbeatInvocation(true);
    /**
     * The constant PONG.
     */
    public static final HeartbeatInvocation PONG = new HeartbeatInvocation(false);

    private HeartbeatInvocation(boolean ping) {
        this.ping = ping;
    }

    @Override
    public String toString() {
        return this.ping ? "ping" : "pong";
    }

    public boolean isPing() {
        return ping;
    }

    public void setPing(boolean ping) {
        this.ping = ping;
    }
}
